package com.fesine.learn.service.impl;

import com.fesine.learn.dao.IDaoService;
import com.fesine.learn.po.UserInfoPo;
import com.fesine.learn.service.UserInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description: 用户信息service实现
 * @author: Fesine
 * @createTime:2017/3/30 19:38
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2017/3/30 19:38
 */
@Service("userInfoService")
public class UserInfoServiceImpl implements UserInfoService {

    @Resource
    private IDaoService daoService;


    @Override
    public int addUserInfo(UserInfoPo userInfoPo) {
        return daoService.insert(userInfoPo);
    }

    @Override
    public int modifyUserInfo(UserInfoPo userInfoPo) {
        return daoService.update(userInfoPo);
    }

    @Override
    public int deleteUserInfo(UserInfoPo userInfoPo) {
        return daoService.delete(userInfoPo);
    }

    @Override
    public void deleteUsers(String[] ids) {
        UserInfoPo userInfoPo;
        for (String id : ids) {
            userInfoPo = new UserInfoPo();
            userInfoPo.setId(id);
            this.deleteUserInfo(userInfoPo);
        }
    }

    @Override
    public UserInfoPo getUserInfo(UserInfoPo userInfoPo) {
        return daoService.selectOne(userInfoPo);
    }

    @Override
    public List<UserInfoPo> listUserInfo(UserInfoPo userInfoPo) {
        return daoService.selectList(userInfoPo);
    }

    @Override
    public List<UserInfoPo> listUserInfo(UserInfoPo userInfoPo, int pageNo, int pageSie) {
        return daoService.selectList(userInfoPo, pageNo, pageSie);
    }

    @Override
    public int getTotal(UserInfoPo userInfoPo) {
        return daoService.count(userInfoPo);
    }
}
